package com.heima.wemedia.scheduled;

import com.heima.wemedia.config.BaiduTokenCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * @author xiaquanen
 * @version 1.0
 * @project heima-leadnews
 * @date 2024/7/23 11:10:48
 */
@Component
public class BaiduCacheScheduled {
    @Autowired
    private BaiduTokenCache baiduTokenCache;

    @Scheduled(cron = "0 0 0 ? */15 *")
    @PostConstruct
    public void deleteToken(){
        baiduTokenCache.getTokenCache().clear();
    }
}
